<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
	<meta charset="UTF-8">
	<link rel="bookmark"  type="image/x-icon"  href="resources/images/yueoe-logo.png"/>
	<link rel="shortcut icon" href="resources/images/yueoe-logo.png">
    <title>悦动星辰智能进销存</title>

    <style>
        .div{
            height: 20px;
            background-color: red;
            -webkit-animation-name: example;
            -webkit-animation-duration: 60s;
            -webkit-animation-iteration-count: 60;
            animation-name: example;
            animation-duration: 60s;
            animation-iteration-count: 60;
        }
        .center{
            height: 50px;  /* Can be anything */
            left: 50%;
            top: 50%;
            width: 100%;
            position: absolute;
            font-family: 'Microsoft YaHei', sans-serif;
            font-size: 20px;
        }
        .meter {
            height: 5px;  /* Can be anything */
            left: 0;
            top: 50%;
            position: absolute;
            background: #555;
            -moz-border-radius: 5px;
            -webkit-border-radius: 5px;
            border-radius: 5px;
            -webkit-box-shadow: inset 0 -1px 1px rgba(255,255,255,0.3);
            -moz-box-shadow   : inset 0 -1px 1px rgba(255,255,255,0.3);
            box-shadow        : inset 0 -1px 1px rgba(255,255,255,0.3);
        }

        /* Safari 4.0 - 8.0 */
        @-webkit-keyframes example {
            0%   {background-color:#33dd33; width: 20px;}
            50%   {background-color:#dd3333; width: 50%;}
            100%  {background-color:#3333dd; width: 100%;}
        }

        /* Standard syntax */
        @keyframes example {
            0%   {background-color:#33dd33;width: 20px;}
            50%   {background-color:#dd3333; width: 50%;}
            100%  {background-color:#3333dd; width: 100%;}
        }
    </style>
    <link rel="stylesheet" type="text/css" href="js/message.css"/>
	<div class='meter div' id="loadHTMLprogress2017" style="display: none"></div>
	<!--<div class='center' id="loadHTMLText2017">正在加载......</div>-->
	<!--<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=N8WwNLYdDCddfGkZ6TKQIODG23xMhnmI"></script>-->

	<link rel="stylesheet" type="text/css" href="login/css/normalize.css"/>
	<link rel="icon" href="login/img/stars-logo-hs.png" type="img/x-ico"/>
	<link rel="stylesheet" type="text/css" href="login/css/demo.css"/>
	<!--必要样式-->
	<link rel="stylesheet" type="text/css" href="login/css/component.css"/>
	
	<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
	<script type="text/javascript" src="js/delaunator.min.js"></script>
	<script type="text/javascript" src="js/message.js"></script>
	<script type="text/javascript" src="js/background.js"></script>
	<script type="text/javascript" src="js/md5.js"></script>

</head>
<body>
<div class="container demo-1" id="loadHTMLText2017">
    <div class="content">
        <div id="large-header" class="large-header">
            <canvas id="canvas" style="width: 100%; height: 100%;"></canvas>
            <div class="logo_box">
                <div><img src="login/img/yueoe.png" style="width:280px;position:relative;left: 20px"></div>

                <h3>欢迎您</h3>
                <form action="#" name="f" method="post">
                    <div class="input_outer">
                        <span class="u_user"></span>
                        <input name="userName" class="text" style="color: #FFFFFF !important" type="text"
                               placeholder="请输入账户">
                    </div>
                    <div class="input_outer">
                        <span class="us_uer"></span>
                        <input name="password" class="text"
                               style="color: #FFFFFF !important; position:absolute; z-index:100;" value=""
                               type="password" placeholder="请输入密码">
                    </div>
                    <div class="mb2"><a class="act-but submit" href="javascript:login()" style="color: #FFFFFF">登录</a></div>
					<div style="background:transparent;position:relative;bottom: -60px;left:20px;">
						<span id="footer_0_tCopyRight">©2019 悦动星辰科技（深圳）有限公司 <br> 粤ICP备19152575</span>
					</div>
                </form>
            </div>
        </div>
    </div>
	
</div><!-- /container -->
<script type="text/javascript">
    var Authorization = localStorage.getItem('Authorization');
	if(Authorization){
		setTimeout(function () {
            Ext.Microloader.run();
        },50);
		$("#loadHTMLText2017").attr("style","display:none;");
	}else{
		if (!!window.ActiveXObject || "ActiveXObject" in window){

		}else{
			var canvas = document.getElementById('canvas');
			canvas.height = window.innerHeight;
			var spaceboi = new Thpace(canvas);
			spaceboi.start();
		}
	}
	$("input[ name='userName']").bind('keyup',function(event){
		if(event.keyCode == "13")
		{
			login();
		}
	});
	$("input[ name='password']").bind('keyup',function(event){
		if(event.keyCode == "13")
		{
			login();
		}
	});
	function login() {
		//1.先拿到帐号和密码
		var data = {
			userName: $("input[ name='userName']").val(),
			password: $("input[ name='password']").val()
		};
		var myRoot = {};
		$.ajax({
			//请求方式
			type : "POST",
			//请求的媒体类型
			dataType: "json",
			//请求地址
			url : "api/auth/token",
			//数据，json字符串
			data : {
				username: data.userName.trim(),
				password: hex_md5(data.password)
			},
			//请求成功
			success : function(obj) {
				if(obj.hasErrors){
					$.message({
						message:obj.errorMessage,
							type:'error'
					});
					return;
				}
				localStorage.setItem("Authorization", obj.data.token);
				localStorage.setItem("currentUser", JSON.stringify(obj.data.user));
				document.cookie = "userId="+obj.data.user.id;
				$("#loadHTMLText2017").attr("style","display:none;");
				$("#loadHTMLprogress2017").attr("style","display:'inline';");
				Ext.Microloader.run();
			},
			//请求失败，包含具体的错误信息
			error : function(e){
				console.log(e.status);
				console.log(e.responseText);
			}
		});
	}
	
	$(document).ready(function(){
		function stopScrolling( touchEvent ) {
			touchEvent.preventDefault();
		}
		document.addEventListener( 'touchstart' , stopScrolling , false );
		document.addEventListener( 'touchmove' , stopScrolling , false );
	});
	//处理键盘事件 禁止后退键（Backspace）密码或单行、多行文本框除外
	function banBackSpace(e){
		var ev = e || window.event;//获取event对象
		var obj = ev.target || ev.srcElement;//获取事件源

		var t = obj.type || obj.getAttribute('type');//获取事件源类型

		//获取作为判断条件的事件类型
		var vReadOnly = obj.getAttribute('readonly');
		var vEnabled = obj.getAttribute('enabled');
		//处理null值情况
		vReadOnly = (vReadOnly == null) ? false : vReadOnly;
		vEnabled = (vEnabled == null) ? true : vEnabled;

		//当敲Backspace键时，事件源类型为密码或单行、多行文本的，
		//并且readonly属性为true或enabled属性为false的，则退格键失效
		var flag1=(ev.keyCode == 8 && (t=="password" || t=="text" || t=="textarea")
			&& (vReadOnly==true || vEnabled!=true))?true:false;

		//当敲Backspace键时，事件源类型非密码或单行、多行文本的，则退格键失效
		var flag2=(ev.keyCode == 8 && t != "password" && t != "text" && t != "textarea")
			?true:false;

		//判断
		if(flag2){
			return false;
		}
		if(flag1){
			return false;
		}
	}

	//禁止后退键 作用于Firefox、Opera
	//document.onkeypress=banBackSpace;
	//禁止后退键 作用于IE、Chrome
	//document.onkeydown=banBackSpace;
	window.onload=function(){
		document.getElementsByTagName("body")[0].onkeydown =function(){

			//获取事件对象
			var elem = event.relatedTarget || event.srcElement || event.target ||event.currentTarget;

			if(event.keyCode==8){//判断按键为backSpace键

				//获取按键按下时光标做指向的element
				var elem = event.srcElement || event.currentTarget;

				//判断是否需要阻止按下键盘的事件默认传递
				var name = elem.nodeName;

				if(name!='INPUT' && name!='TEXTAREA'){
					return _stopIt(event);
				}
				var type_e = elem.type.toUpperCase();
				if(name=='INPUT' && (type_e!='TEXT' && type_e!='TEXTAREA' && type_e!='PASSWORD' && type_e!='FILE')){
					return _stopIt(event);
				}
				if(name=='INPUT' && (elem.readOnly==true || elem.disabled ==true)){
					return _stopIt(event);
				}
			}
		}
	};
	function _stopIt(e){
		if(e.returnValue){
			e.returnValue = false ;
		}
		if(e.preventDefault ){
			e.preventDefault();
		}

		return false;
	}
</script>
<script type="text/javascript">
    var Ext = Ext || {}; // Ext namespace won't be defined yet...

    Ext.beforeLoad = function (tags) {
        var s = location.search,  // the query string (ex "?foo=1&bar")
            profile = 'classic';

        Ext.manifest = profile; // this name must match a build profile name

    };
</script>
<script type="text/javascript" src="js/jquery.jqprint-0.3.js"></script>
<script type="text/javascript" src="js/echarts.min.js"></script>
<script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="js/macarons.js"></script>
<script type="text/javascript" src="bootstrap.js"></script>
<script type="text/javascript" src="Admin/classic/app.js"></script>

</body>
</html>